/*
* Copyright (c) 2007 by Kirill Kolodyazhniy.
* See the file "license.terms" for information on usage and redistribution.
*/

#ifndef M_DXRENDERDATA_H
#define M_DXRENDERDATA_H

#include "renderdata.h"

namespace Engine
{
	/**
	*   Abstract class defining the interface all render data must implement.
	*/
	class DXRenderData:public RenderData
	{
	public:

		DXRenderData()
			:m_vertexDeclaration(0)
			,m_vertexSize(0)
			,m_vertexBuffer(0)
			,m_indexBuffer(0)
			,m_baseVertex(0)
			,m_startVertex(0)
			,m_startIndex(0)
			,m_vertexCount(0)
			,m_primitiveCount(0)
		{}

	DXRenderData(IDirect3DVertexDeclaration9* vertexDeclaration,
				UINT vertexSize,
				IDirect3DVertexBuffer9* vertexBuffer,
				IDirect3DIndexBuffer9* indexBuffer,
				INT baseVertex,
				UINT startVertex,
				UINT startIndex,
				UINT primitiveCount,
				UINT vertexCount,
				D3DPRIMITIVETYPE primitiveType)
			:m_vertexDeclaration(vertexDeclaration)
			,m_vertexSize(vertexSize)
			,m_vertexBuffer(vertexBuffer)
			,m_indexBuffer(indexBuffer)
			,m_baseVertex(baseVertex)
			,m_startVertex(startVertex)
			,m_startIndex(startIndex)
			,m_vertexCount(vertexCount)
			,m_primitiveCount(primitiveCount)
			,m_primitiveType(primitiveType)
		{

		}


		virtual void SetStartVertex(unsigned int val){m_startVertex = val;}
		virtual unsigned int GetStartVertex(){return m_startVertex;}
		virtual void SetVertexCount(unsigned int val){m_vertexCount = val;}
		virtual unsigned int GetVertexCount() const {return m_vertexCount;}

		virtual void SetStartIndex(unsigned int val){m_startIndex = val;}
		virtual unsigned int GetStartIndex(){return m_startIndex;}
		virtual void SetPrimitiveCount(unsigned int val){m_primitiveCount = val;}
		virtual unsigned int GetPrimitiveCount(){return m_primitiveCount;}


		IDirect3DVertexDeclaration9* GetVertexDeclaration(){return m_vertexDeclaration;}
		UINT GetVertexSize() { return m_vertexSize;}
		IDirect3DVertexBuffer9* GetVertexBuffer() { return m_vertexBuffer;}
		IDirect3DIndexBuffer9* GetIndexBuffer(){ return m_indexBuffer;}
		INT GetBaseVertex() {return m_baseVertex;}
		D3DPRIMITIVETYPE GetPrimitiveType() {return m_primitiveType;}

	private:
		IDirect3DVertexDeclaration9* m_vertexDeclaration;
		UINT m_vertexSize;
		IDirect3DVertexBuffer9* m_vertexBuffer;
		IDirect3DIndexBuffer9* m_indexBuffer;
		INT m_baseVertex;
		UINT m_startVertex;
		UINT m_startIndex;
		UINT m_vertexCount;
		UINT m_primitiveCount;
		D3DPRIMITIVETYPE m_primitiveType;

	};
}

#endif
